﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using WpfElevator.RequisitionPart;
using WpfElevator.ControlPart;
using AbstractFramework.LogicControl;
using AbstractFramework.Constant;

namespace WpfElevator.ElevatorPart
{

    //class Button
    //{
    //    //public ButtonState bState;
    //    //public ButtonType bType; //是一种flag,标识按钮类型
    //    private Controller controllerOfButton;
    //    public Controller ControllerOfButton
    //    {
    //        get { return controllerOfButton; }
    //        set { controllerOfButton = value; }
    //    }
    //}
    class OutsideButton : IOutsideButton
    {
        //产生ButtonRequisition的代码
        //【该请求包括：（1）用户所在楼层。（2）用户请求的方向（上行/下行）。】
        private int waitFloor;//用户所在楼层
        private int moveDirection;//用户请求的方向（上行/下行）
        public int WaitFloor
        {
            get { return waitFloor; }
            set { waitFloor = value; }
        }
        public int MoveDirection
        {
            get { return moveDirection; }
            set { moveDirection = value; }
        }
        public OutsideButton(int pWaitFloor, int pMoveDirection)
        {
            waitFloor = pWaitFloor;
            moveDirection = pMoveDirection;
            //bState = ButtonState.pushed;
            //bType = ButtonType.outsideButton;
        }

        public void createButtonRequisition()
        {
            RequisitionType reqType = RequisitionType.outsideReq;
            ButtonRequisition req = new ButtonRequisition(reqType,waitFloor,moveDirection);
            req.createNewRequisition();
        }
    }
    class InsideButton : IInsideButton
    {
        //产生ButtonRequisition的代码
        //请求包括：（1）用户所在电梯序号k。（2）用户要到达的楼层i 。
        private int elevatorNo;//用户所在电梯序号
        private int destinationFloor;//用户要到达的楼层

        public int ElevatorNo
        {
            get { return elevatorNo; }
            set { elevatorNo = value; }
        }
        public int DestinationFloor
        {
            get { return destinationFloor; }
            set { destinationFloor = value; }
        }
        public InsideButton(int pElevatorNo, int pDestinationFloor)
        {
            elevatorNo = pElevatorNo;
            destinationFloor = pDestinationFloor;
            //bState = ButtonState.pushed;
            //bType = ButtonType.insideButton;
        }

        public void createButtonRequisition()
        {
            RequisitionType reqType = RequisitionType.insideReq;
            ButtonRequisition req = new ButtonRequisition(reqType, destinationFloor , elevatorNo);
            req.createNewRequisition();
        }
    }
    class FireButton : IFireButton
    {
        //产生ButtonRequisition的代码
        public FireButton()
        {
            //bState = ButtonState.pushed;
            //bType = ButtonType.fireButton;
        }

        public void createButtonRequisition()
        {
            RequisitionType reqType = RequisitionType.fireReq;
            ButtonRequisition req = new ButtonRequisition(reqType);
            req.createNewRequisition();
        }
    }
}
